import loading from '../loading-ui.vue'
let $vm;
export default  {
    install(Vue, option){
        if (!$vm) {
            const Loading = Vue.extend(loading);
            $vm = new Loading({
                el: document.createElement('div')
            });
            document.body.appendChild($vm.$el);
        }
        Vue.$loading = {
            show() {
                $vm.loading = true;
            },
            hide() {
                $vm.loading = false;
            }
        }
        Vue.mixin({
            created() {
                this.$loading = Vue.$loading;
            }
        })
    }
}